package com.hndzyu.yd.widget;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;

import com.hndzyu.yd.R;

/**
 * Created by zz9527 on 2018/12/10.
 */
public class VipDIalog extends Dialog {

    private VIPListener mVIPListener;
    private ImageView iv;
    private TextView title;
    private TextView neirong;
    private TextView tv_false;
    private TextView tv_true;
    private TextView tv1;
    private TextView tv2;

    public void setVIPListener(VIPListener vipListener) {
        mVIPListener = vipListener;
    }

    public VipDIalog(@NonNull Context context) {
        super(context, R.style.my_dialog);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (null != getWindow()){
            WindowManager.LayoutParams lp = getWindow().getAttributes();
            lp.dimAmount = 0.5f;
            getWindow().setAttributes(lp);
        }
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        setContentView(R.layout.vip_dialog);
        tv1 = findViewById(R.id.tv1);
        tv2 = findViewById(R.id.tv2);
        tv_false = findViewById(R.id.tv_false);
        tv_true = findViewById(R.id.tv_true);
        iv = findViewById(R.id.iv);
        tv_false.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mVIPListener.chooseFalse();
            }
        });
        tv_true.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mVIPListener.chooseTrue();
            }
        });
    }

    public void upVipzhangmeng(){
        iv.setImageResource(R.mipmap.zhangmeng);
        tv1.setText("");
        tv_true.setText("立即升级");
        tv2.setVisibility(View.INVISIBLE);
    }
    public void upVipmengzhu(){
        iv.setImageResource(R.mipmap.mengzhu);
        tv1.setText("享受至高盟主权益");
        tv_true.setText("立即升级");
        tv2.setVisibility(View.INVISIBLE);
    }
    public void setMessage(String textStr){
    }
    public void setContent(){

    }
    @Override
    public void dismiss() {
        super.dismiss();
    }
    public interface VIPListener{
        void chooseTrue();
        void chooseFalse();
    }
}
